Skip to content

Group text edits for undo/redo unless preview is live - #3563

Open
ethancrawford wants to merge 1 commit into
sonic-pi-net:devfrom
ethancrawford:group-text-edits-for-undo-redo
Open

Group text edits for undo/redo unless preview is live#3563
ethancrawford wants to merge 1 commit into
sonic-pi-net:devfrom
ethancrawford:group-text-edits-for-undo-redo

Conversation

@ethancrawford

Copy link
Copy Markdown
Collaborator

Previously, every individual keypress was treated as a separate event for undo/redo. This meant that multiple presses of the delete or backspace keys were undone/redone one at a time, which is a very slow and laborious process.

Only signalling an undo action if a preview is live allows multiple normal text edits to be grouped into a single undo/redo.

@samaaron I'm still in the process of understanding the v5 code, so I'd appreciate your eyes and any comments on this fix. It does appear to do what I would expect, namely allow normal text edits to be grouped in a single undo/redo action, while leaving live preview values as individual undo actions. I have tested it by doing the following:

  • Typed play 60, pan: , scrolling to change the pan value a few times, and hitting Esc. Undoing cycles back through the inserted preview values and back to play 60, pan: . Redo does the reverse.
  • Typed chord :C, , scrolled to change the chord name a few times, and hitting Esc. Same undo/redo behaviour as above.
  • Typed play , and immediately backspaced to remove it. Undo/redo restores/removes it in whole, rather than a letter at a time.
  • Typed # test and immediately backspaced to remove it. Same undo/redo behaviour as above.

Previously, every individual keypress was treated as a separate event for
undo/redo. This meant that multiple presses of the delete or backspace keys were
undone/redone one at a time, which is a very slow and laborious process.

Only signalling an undo action if a preview is live allows multiple normal text
edits to be grouped into a single undo/redo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text insertions/deletions are not grouped when using undo/redo

1 participant